package com.yunxi.service.dubboService.impl.vehicle.bizToBaseData;


import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import com.github.pagehelper.PageInfo;
import com.yunxi.bizToBaseData.pojo.VehicleProductReqVO;
import com.yunxi.bizToBaseData.pojo.VehicleProductRespVO;
import com.yunxi.bizToBaseData.service.SToSVehicleProductDubboService;
import com.yunxi.model.vehicle.VehicleProduct;
import com.yunxi.service.localService.vehicle.VehicleProductService;

import com.yunxi.vehicle.pojo.VehicleProductVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

public class SToSVehicleProductDubboServiceImpl implements SToSVehicleProductDubboService {

    @Autowired
    VehicleProductService vehicleProductServiceImpl;

    @Override
    @Transactional
    @LcnTransaction
    public VehicleProductRespVO queryByCondition(VehicleProductReqVO vo) {
        VehicleProductVO vehicleProductVO = new VehicleProductVO();
        BeanUtils.copyProperties(vo,vehicleProductVO);
        PageInfo<VehicleProduct> pageInfo = vehicleProductServiceImpl.findPageByVO(vehicleProductVO,1,1);
        if(pageInfo != null && pageInfo.getList().size() != 0){
            VehicleProductRespVO respVO = new VehicleProductRespVO();
            BeanUtils.copyProperties(pageInfo.getList().get(0),respVO);
            return respVO;
        }
        return null;
    }
}
